package com.hxzy.controller.unit;

import com.alibaba.fastjson.JSONObject;
import com.hxzy.common.BaseServlet;
import com.hxzy.common.ResultAjax;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: lqq
 * @Description:
 * @Date: 2022/3/9 19:59
 */
@WebServlet(urlPatterns = "/common/lift")
public class ElevatorServlet extends BaseServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Map<String,Object> map1=new HashMap<>();
        map1.put("id", 1);
        map1.put("value", 0);
        map1.put("label", "有");

        Map<String,Object> map2=new HashMap<>();
        map2.put("id", 2);
        map2.put("value", 1);
        map2.put("label", "无");

        //变为集合
        List<Map<String,Object>> list=new ArrayList<>();
        list.add(map1);
        list.add(map2);
        ResultAjax resultAjax = ResultAjax.succss_data(list);
        super.render(resp, JSONObject.toJSONString(resultAjax));


    }
}
